﻿@{ Layout = "../../Views/Shared/_LayoutPhone.cshtml";}
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <!-- favicons -->
    <link rel="apple-touch-icon" href="img/favicon-apple.png">
    <link rel="icon" href="img/favicon.png">

    <!-- Bootstrap CSS -->
    <!-- Material design icons CSS -->
    <link rel="stylesheet" href="~/GoTRI/vendor/materializeicon/material-icons.css">
    <!-- aniamte CSS -->
    <link rel="stylesheet" href="~/GoTRI/vendor/animatecss/animate.css">

    <!-- swiper carousel CSS -->
    <link rel="stylesheet" href="~/GoTRI/vendor/swiper/css/swiper.min.css">

    <!-- daterange CSS -->
    <link rel="stylesheet" href="~/GoTRI/vendor/bootstrap-daterangepicker-master/daterangepicker.css">

    <!-- footable CSS -->
    <link rel="stylesheet" href="~/GoTRI/vendor/footable-bootstrap/css/footable.bootstrap.min.css">

    <!-- jvector map CSS -->
    <link rel="stylesheet" href="~/GoTRI/vendor/jquery-jvectormap/jquery-jvectormap-2.0.3.css">

    <!-- app CSS -->
    <link id="theme" rel="stylesheet" href="~/GoTRI/css/purplesidebar.css" type="text/css">

    <link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/font-awesome/4.6.0/css/font-awesome.min.css">
    <link href="~/tree.css" rel="stylesheet" />

    <title>GoTRI - Mobile</title>
</head>

<body class="fixed-header sidebar-right-close sidebar-left-close">
    <header style="width: 100%; height: 4rem; background-color: rgb(255,135,0);top:0px;position: fixed;z-index: 1;">
        <a href="javascript:void(window.location.href='https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww500458ad942a211f&redirect_uri=http://web.xyufu.cn/PhoneShouYe/ShouYe&response_type=code&scope=snsapi_privateinfo&agentid=1000002&state=STATE#wechat_redirect')" id="a">
            <img src="~/GoTRI/img/left.png" alt="" style="float: left;
            width: 1rem;
            height: 2rem;
            margin-left: 1rem;
            margin-top: 1rem;
            position:absolute;
	        left:0px;
	        top:0px;
	        z-index:1;">
        </a>
        <div style=" width: 100%; height: 4rem; line-height: 4rem; text-align: center; color: #fff; font-size: 1.3rem;">周报</div>
    </header>
    <div style="width:1px;padding-bottom:50px"></div>
    <script>
        $(".yi").attr("hidden", "");
    </script>
    <div class="container mt-4 main-container">
        <div class="card mb-4">
            <div class="card-header border-bottom">
                <h5 class="content-color-primary mb-0">周报</h5>
            </div>
            <div class="card-body">
                <div class="row justify-content-center">
                    <div class="col-md-10 mx-auto">
                        <div class="form-group row">
                            <div class="col-lg-6 col-md-6">
                                <label id="jieshouhuibao" style="margin-top:10px;">汇报给</label>
                                <div id="quanbu" hidden="hidden">
                                    <input id="qiangnihuibaoren" hidden="hidden" style="margin-bottom:15px; width: 100%" disabled="disabled"><br />
                                    <label id="huibaoshijian" hidden="hidden">汇报时间</label><br />
                                    <input id="huibaoshiantianxie" hidden="hidden" style="margin-bottom:15px; width: 100%" disabled="disabled">
                                </div>

                                <div id="xianshihuibaoren" class="select-tree-wrap" style="width:100%"></div>

                                @*<select class="form-control" style="margin-bottom:15px" data-live-search="true" id="xianshihuibaoren" tabindex="-1" aria-hidden="true">
                                </select>*@
                            </div>
                            <div class="col-lg-6 col-md-6">
                                <label>本周工作</label>
                                <textarea id="TextArea1" rows="5" cols="50" class="form-control"></textarea>
                            </div>
                            <div class="col-lg-6 col-md-6">
                                <label style="margin-top:10px;">下周计划</label>
                                <textarea id="TextArea2" rows="5" cols="50" class="form-control"></textarea>
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col-lg-6 col-md-6">
                                <label>其他事项</label>
                                <textarea id="TextArea3" rows="5" cols="50" class="form-control"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="card-footer" style="text-align: center;width:100%">
                <button class="btn btn-success float-right" id="tijiao" onclick="tijiao()" style="width:100%; margin-bottom:70px;">提交</button>
                <button class="btn btn-success float-right" hidden="hidden" id="yuedu" onclick="ydugangneng()" style="width:100%; margin-bottom:70px;">阅读</button>
            </div>
            <input type="text" hidden="hidden" id="idzhi" />
        </div>
    </div>
    <div style="margin-bottom: 50px;padding-bottom:1px"></div>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="~/GoTRI/js/jquery-3.2.1.min.js"></script>
    <script src="~/GoTRI/js/popper.min.js"></script>

    <!-- Cookie jquery file -->
    <script src="~/GoTRI/vendor/cookie/jquery.cookie.js"></script>

    <!-- sparklines chart jquery file -->
    <script src="~/GoTRI/vendor/sparklines/jquery.sparkline.min.js"></script>

    <!-- Circular progress gauge jquery file -->
    <script src="~/GoTRI/vendor/circle-progress/circle-progress.min.js"></script>

    <!-- Swiper carousel jquery file -->
    <script src="~/GoTRI/vendor/swiper/js/swiper.min.js"></script>

    <!-- Chart js jquery file -->
    <script src="~/GoTRI/vendor/chartjs/Chart.bundle.min.js"></script>
    <script src="~/GoTRI/vendor/chartjs/utils.js"></script>

    <!-- Footable jquery file -->
    <script src="~/GoTRI/vendor/footable-bootstrap/js/footable.min.js"></script>

    <!-- datepicker jquery file -->
    <script src="~/GoTRI/vendor/bootstrap-daterangepicker-master/moment.js"></script>
    <script src="~/GoTRI/vendor/bootstrap-daterangepicker-master/daterangepicker.js"></script>

    <!-- jVector map jquery file -->
    <script src="~/GoTRI/vendor/jquery-jvectormap/jquery-jvectormap.js"></script>
    <script src="~/GoTRI/vendor/jquery-jvectormap/jquery-jvectormap-world-mill-en.js"></script>

    <!-- datepicker jquery file -->
    <script src="~/GoTRI/vendor/bootstrap-daterangepicker-master/moment.js"></script>
    <script src="~/GoTRI/vendor/bootstrap-daterangepicker-master/daterangepicker.js"></script>

    <!-- Dropzone jquery file -->
    <script src="~/GoTRI/vendor/dropzone-master/dropzone.js"></script>

    <!-- circular progress file -->
    <script src="~/GoTRI/vendor/circle-progress/circle-progress.min.js"></script>

    <!-- Application main common jquery file -->
    <script src="~/GoTRI/js/main.js"></script>
    <script src="~/admui-13945148017-1592211513218/public/js/tsk/sweetalert.min.js"></script>

    <script src="~/comboTreePlugin.js"></script>

    <!-- page specific script -->
    <script>

        $(document).ready(function () {
            var shu = getQuery("id");
            var benren = getQuery("benren");
            $("#idzhi").val(shu);
            if (shu != null && shu != "0") {
                $('#xianshihuibaoren').attr('hidden', "hidden");
                $('#tijiao').attr('hidden', "hidden");
                $('#TextArea1').attr('disabled', "true");
                $('#TextArea2').attr('disabled', "true");
                $('#TextArea3').attr('disabled', "true");

                $('#quanbu').removeAttr("hidden");
                $('#qiangnihuibaoren').removeAttr("hidden");
                $('#jieshouhuibao').text("发送人");
                $('#huibaoshijian').removeAttr("hidden");
                $('#huibaoshiantianxie').removeAttr("hidden");
                //$('#a').removeAttr("hidden");

                if (benren == "1" && benren != null) {
                    $('#a').removeAttr("href");
                    $('#a').attr('href', "BenRenHuiBaoList");
                } else {
                    $('#yuedu').removeAttr("hidden");
                    $('#a').removeAttr("href");
                    $('#a').attr('href', "HuiBaoList");
                }
                huibaoxinxi(shu);
            } else {
                huibaoren();
                //$('#a').attr('hidden', "hidden");
            }
        });

        function ydugangneng() {
            $("#nb").removeAttr("hidden");
            $("#yuedu").attr("disabled", "disabled");
            var id = $("#idzhi").val();
            $.ajax({
                type: 'post',
                url: '../PhoneHuiBao/upHuiBaoList',
                dataType: 'text',
                async: true,
                data: { id: id },
                success: function (result) {
                    $("#nb").attr("hidden", "");
                    $("#yuedu").attr("disabled", "block");
                    if (result == "1") {
                        swal("已读成功 （该数据将不会在显示）!", "操作成功!", "success");
                        location.href = "../PhoneHuiBao/HuiBaoList";
                    } else {
                        swal("已读失败!", "操作出现异常!", "error");
                    }
                }
            });
        }

        function huibaoxinxi(id) {
            $.ajax({
                type: 'post',
                url: '../PhoneHuiBao/xianshihuibaoxinxi',
                async: false,
                dataType: 'json',
                data: { id: id },
                success: function (date) {
                    $(date).each(function (key) {
                        $('#qiangnihuibaoren').val(date[key].huiBaoRen);
                        $('#TextArea1').val(date[key].ben);
                        $('#TextArea2').val(date[key].xia);
                        $('#TextArea3').val(date[key].qita);
                        $('#huibaoshiantianxie').val(date[key].shijian);
                    })
                },
            })
        }
        function huibaoren() {
            $.ajax({
                type: 'post',
                url: '../PhoneHuiBao/GetHuiBaoRen',
                async: false,
                dataType: 'json',
                success: function (date) {
                    if (date != null && date != "") {
                        var SampleJSONData = date;
                        let bbb = $('#xianshihuibaoren').comboTree({
                            source: SampleJSONData,
                            isMultiple: true,
                            isFirstClassSelectable: false, //第一级是否可选
                            cascadeSelect: true,
                            selectedlength: 100 //最多可选
                        });
                    } else {
                        var ddl = $("#xianshihuibaoren");
                        ddl.append("<option value='0'>请给该员工添加岗位</option>");
                    }
                },
            })
        }

        function tijiao() {
            var shuju = $('.select-menu-input').attr('data-id');
            var dangqian = $("#TextArea1").val();
            var xia = $("#TextArea2").val();
            var qita = $("#TextArea3").val();
            var zhuangtai = "周报";
            var huibaorenid = shuju;
            if (dangqian == null && dangqian == "") {
                swal("本周工作不能为空!", "操作出现异常!", "error");
            } else if (xia == null && xia == "") {
                swal("下周工作不能为空!", "操作出现异常!", "error");
            } else if (qita == null && qita == "") {
                swal("其他计划不能为空!", "操作出现异常!", "error");
            } else if (huibaorenid == "" && huibaorenid != null) {
                swal("汇报人不能为空!", "操作出现异常!", "error");
            } else {
                $("#nb").removeAttr("hidden");
                $("#tijiao").attr("disabled", "disabled");
                $.ajax({
                    type: 'post',
                    url: '../PhoneHuiBao/GetHuiAdd',
                    async: false,
                    dataType: 'text',
                    data: { dangqian: dangqian, xia: xia, qita: qita, zhuangtai: zhuangtai, huibaorenid: huibaorenid },
                    success: function (result) {
                        $("#nb").attr("hidden", "");
                        $("#tijiao").attr("disabled", "block");
                        if (result == "1") {
                            swal("添加成功 （该数据将不会在显示）!", "操作成功!", "success");
                            location.href = "../PhoneHuiBao/BenRenHuiBaoList";
                        } else {
                            swal("添加失败!", "操作出现异常!", "error");
                        }
                    },
                })
            }
        }


        function getQuery(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]); return null;
        }

    </script>
</body>

</html>
